# Maintainer: Anatol Pomozov

pkgname=aws-c-compression
pkgver=0.2.17
pkgrel=1
pkgdesc='C99 implementation of huffman encoding/decoding'
arch=(loong64 x86_64)
url='https://github.com/awslabs/aws-c-compression'
license=(Apache)
depends=(aws-c-common)
makedepends=(cmake)
source=(aws-c-compression-$pkgver.zip::https://github.com/awslabs/aws-c-compression/archive/v$pkgver.zip)
sha256sums=('a94e8ff8c5591e252bb3d17d2b767169f0390b111f690f640aee76098c550e7f')

build() {
  cd aws-c-compression-$pkgver

  cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr -DBUILD_SHARED_LIBS=ON -S . -B build
  cmake --build build
}

check() {
  cd aws-c-compression-$pkgver
  cmake --build build --target test
}

package() {
  cd aws-c-compression-$pkgver

  cmake --build build --target install -- DESTDIR="$pkgdir/"
  install -Dm644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}
